import Mock from "mockjs"




let url = "http://127.0.0.1:3000"


// 解构这个变量出来  方便下面拦截引用
let {news,goods} = Mock.mock({
    "news|10":[
        {
            "id|+1":1,
            "title":"@ctitle(5,10)",
            "author":"@cname",
            "date":Mock.Random.date('yyyy-MM-dd'),
            "content":"@paragraph(1, 3)"
        }
    ],
    "goods|7":[
        {
            "id|+1":1,
            "title":"@ctitle(5,10)",
            "price":"@float(60, 100, 0, 1)",
            "count":"@integer(60, 100)",
            "color|3":{
                "blue":"蓝色",
                "red":"红色",
                "pink":"粉色"
            },
            "img":Mock.Random.image('200x100', '#894FC4', '#FFF', 'png', 'Hello!')
        }
        
    ]
})



Mock.mock(url+"/news","get",()=>{
    return news
})
Mock.mock(url+"/goods","get",()=>{
    return goods
})



export { news, goods }